package com.cashmama.market.api.application.controller.authentication.vos;

import com.cashmama.market.api.application.enums.AuthenticationTypeEnum;
import com.cashmama.market.api.infras.exception.ApplicationException;
import com.cashmama.market.api.infras.utils.StringUtils;
import com.fqgj.common.api.ParamsObject;

import java.util.Map;

/**
 * @program: market-api
 * @description
 * @author: frank
 * @create: 2019-12-31 16:44
 **/
public class UserProfileSaveRequest extends ParamsObject {

    private String type;
    private Map<String, String> paramsList;

    public String getType() {
        return type;
    }

    public UserProfileSaveRequest setType(String type) {
        this.type = type;
        return this;
    }

    public Map<String, String> getParamsList() {
        return paramsList;
    }

    public UserProfileSaveRequest setParamsList(Map<String, String> paramsList) {
        this.paramsList = paramsList;
        return this;
    }

    @Override
    public void validate() {
        if(StringUtils.isEmpty(type)){
            throw new ApplicationException("type can not be empty");
        }
        if (!AuthenticationTypeEnum.isTypeExist(type)) {
            throw new ApplicationException("wrong type authentication");
        }

    }
}
